<template>
  <div class="employees-container">
    <div class="app-container">
      <el-card>
        <!-- 页签组件 -->
        <el-tabs>
          <el-tab-pane label="登录账户设置">
            <login-setting :user-detail="userDetail" />
          </el-tab-pane>
          <el-tab-pane label="个人详情">
            <user-info :user-detail="userDetail" />
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>

<script>
// 导入获取用户信息详情的接口
import { getUserDetailById } from '@/api/user'
import loginSetting from './components/login-setting.vue'
import UserInfo from './components/user-info.vue'
export default {
  components: {
    loginSetting,
    UserInfo
  },
  data () {
    return {
      userDetail: {}
    }
  },
  created () {
    this.getUserDetail()
  },
  methods: {
    // 获取用户相关的数据
    async getUserDetail () {
      // 1. this.$route.params 获取动态路由的参数
      // 2.this.$route.params.(id):参数名(router里的定的/:(id)
      const res = await getUserDetailById(this.$route.params.id)
      // 赋值
      this.userDetail = res
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
